home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 2 / CU Amiga Magazine's Super CD-ROM 02 (1996)(EMAP Images)(GB)[!][issue 1996-04].iso / magazine / amiga_e / e_v3.2a_extras / pdsrc / ham8demo.e < prev    next >
Text File  |  1992-09-02  |  2KB  |  77 lines

  1. OPT OSVERSION=37
  2.  
  3. MODULE 'gadtools','libraries/gadtools','intuition/intuition','exec/nodes',
  4.        'intuition/screens','intuition/gadgetclass','graphics/text'
  5.  
  6. ENUM ER_NONE,ER_NOSCRN,ER_NOWINDOW
  7.  
  8. DEF wnd=NIL:PTR TO window,
  9.     scr=NIL:PTR TO screen
  10.  
  11. PROC shutdown()
  12.   IF wnd THEN CloseWindow(wnd)
  13.   IF scr THEN CloseScreen(scr)
  14. ENDPROC
  15.  
  16. PROC setup()
  17.   IF (scr:=OpenScreenTagList(NIL,
  18.     [SA_WIDTH,528,SA_HEIGHT,512,SA_DEPTH,8,SA_DISPLAYID,$8804,
  19.      NIL,NIL]))=NIL THEN Raise(ER_NOSCRN)
  20.   IF (wnd:=OpenWindowTagList(NIL,
  21.     [WA_LEFT,0,
  22.      WA_TOP,0,
  23.      WA_WIDTH,528,
  24.      WA_HEIGHT,512,
  25.      WA_IDCMP,IDCMP_MOUSEBUTTONS,
  26.      WA_FLAGS,WFLG_SIMPLE_REFRESH OR WFLG_NOCAREREFRESH OR
  27.               WFLG_ACTIVATE OR WFLG_BORDERLESS,
  28.      WA_CUSTOMSCREEN,scr,
  29.      NIL]))=NIL THEN Raise(ER_NOWINDOW)
  30. ENDPROC
  31.  
  32. PROC draw()
  33.   DEF r,loop1,loop2,loop3
  34.   r:=wnd.rport
  35.   FOR loop1:=0 TO 7
  36.     FOR loop2:=0 TO 7
  37.       SetAPen(r,loop1*8+loop2+64)
  38.       Move(r,loop2*66,loop1*64)
  39.       Draw(r,loop2*66,loop1*64+63)
  40.       FOR loop3:=0 TO 63
  41.         SetAPen(r,loop3+128)
  42.         Move(r,loop2*66+1,loop1*64+loop3)
  43.         Draw(r,loop2*66+1,loop1*64+loop3)
  44.         SetAPen(r,loop3+192)
  45.         Move(r,loop2*66+2+loop3,loop1*64)
  46.         Draw(r,loop2*66+2+loop3,loop1*64+63)
  47.       ENDFOR
  48.     ENDFOR
  49.   ENDFOR
  50. ENDPROC
  51.  
  52. PROC waitmouse()
  53.   DEF mes:PTR TO intuimessage,quit=FALSE
  54.   REPEAT
  55.     IF mes:=GetMsg(wnd.userport)
  56.       IF mes.class=IDCMP_MOUSEBUTTONS THEN quit:=TRUE
  57.       ReplyMsg(mes)
  58.     ELSE
  59.       WaitPort(wnd.userport)
  60.     ENDIF
  61.   UNTIL quit
  62. ENDPROC
  63.  
  64. PROC main() HANDLE
  65.   DEF erlist:PTR TO LONG
  66.   setup()
  67.   draw()
  68.   waitmouse()
  69.   Raise(ER_NONE)
  70. EXCEPT
  71.   shutdown()
  72.   IF exception>0
  73.     erlist:=['open screen','open window']
  74.     EasyRequestArgs(0,[20,0,0,'Could not \s.','OK'],0,[erlist[exception-1]])
  75.   ENDIF
  76. ENDPROC
  77.